package com.cencat.user.dto;

import jakarta.validation.constraints.*;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 角色更新DTO
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "角色更新DTO")
public class RoleUpdateDTO {

    @NotNull(message = "角色ID不能为空")
    @Min(value = 1, message = "角色ID必须大于0")
    @Schema(description = "角色ID", example = "1")
    private Long id;

    @Size(min = 2, max = 50, message = "角色名称长度必须在2-50之间")
    @Schema(description = "角色名称", example = "系统管理员")
    private String roleName;

    @Size(min = 2, max = 50, message = "角色编码长度必须在2-50之间")
    @Pattern(regexp = "^[A-Z_]+$", message = "角色编码只能包含大写字母和下划线")
    @Schema(description = "角色编码", example = "ADMIN")
    private String roleCode;

    @Size(max = 200, message = "角色描述长度不能超过200个字符")
    @Schema(description = "角色描述", example = "系统管理员角色")
    private String description;

    @Min(value = 1, message = "角色类型值不正确")
    @Max(value = 2, message = "角色类型值不正确")
    @Schema(description = "角色类型（1-系统角色，2-业务角色）", example = "1")
    private Integer roleType;

    @Min(value = 0, message = "排序值不能小于0")
    @Schema(description = "排序", example = "1")
    private Integer sortOrder;

    @Min(value = 1, message = "数据权限范围值不正确")
    @Max(value = 5, message = "数据权限范围值不正确")
    @Schema(description = "数据权限范围（1-全部数据，2-本部门及以下，3-本部门，4-仅本人，5-自定义）", example = "1")
    private Integer dataScope;

    @Schema(description = "数据权限部门ID集合（当dataScope=5时使用）", example = "1,2,3")
    private String dataScopeDeptIds;

    @Size(max = 500, message = "备注长度不能超过500个字符")
    @Schema(description = "备注", example = "系统管理员角色")
    private String remark;

    @NotNull(message = "租户ID不能为空")
    @Min(value = 1, message = "租户ID必须大于0")
    @Schema(description = "租户ID", example = "1")
    private Long tenantId;
}